import request from './wrapRequest';
/**
 * 用户列表
 * @param data 
 * @returns 
 */
export interface TableProps{
    _id: string;
    name: string;
    desc: string;
}
/**
 * 暂时不做分页
 * @returns 
 */
export const fetchList = () => {
  return  request.get<TableProps[]>(`/admin/user/table/list`);
}

/**
 * 增加表
 * @param data 
 * @returns 
 */
export const addTable = (data: TableProps) => {
  return  request.put<boolean>(`/admin/user/table/create`, data);
}


/**
 * 更新表
 * @param data 
 * @returns 
 */
export const updateTable = (data: TableProps) => {
  return  request.post<boolean>(`/admin/user/table/update`, data);
}

/**
 * 删除表
 * @param data 
 * @returns 
 */
export const deleteTable = (data: TableProps) => {
  return  request.delete<boolean>(`/admin/user/table/delete/`+ data._id);
}